import xhr from '../request';

export type ListForPageDataItem = {
  ID: 10;
  CreatedAt: string | null;
  DeletedAt: string | null;
  FileType: string;
  MemberId: number;
  Name: string;
  NameEdit?: string;
  IsNameEdit?: boolean;
  Size: number;
  Type: number;
  UniqueKey: string;
  UniqueKeyPreview: string;
  UpdatedAt: string | null;
  DeleteLoading?: boolean;
  EditLoading?: boolean;
}
export type ListForPageData = {
  Data: ListForPageDataItem[];
  Page: number;
  PageSize: number;
  Total: number
}

export default {

  listForPage(params: { Page: number, PageSize: number, Keyword: string, Type: number }) {
    return xhr.request<ListForPageData>({ method: 'get', url: '/V1/Uploader/ListForPage', params });
  },

  add(data: FormData, onUploadProgress?: (e: ProgressEvent) => void) {
    return xhr.request<ListForPageDataItem[]>({ method: 'post', url: '/V1/Uploader/Add', data, onUploadProgress });
  },

  delete(data: { Ids: number[] }) {
    return xhr.request({ method: 'post', url: '/V1/Uploader/Delete', data });
  },

  edit(data: { ID: number, Name: string }) {
    return xhr.request({ method: 'post', url: '/V1/Uploader/Edit', data });
  },




};
